package com.ljn.core.dto.common.utils.assmbler;

import com.ljn.core.dto.Student;
import com.ljn.core.dto.common.User;
import com.ljn.core.dto.common.command.usercommand.Registercommand;
import org.springframework.beans.BeanUtils;

/**
 * Created by 55966005 on 2017/11/3.
 */
public class StudentAssmbler {
    public static Student toStudent(Registercommand registerCommand) {
        Student student = new Student();
        BeanUtils.copyProperties(registerCommand, student);
        return student;
    }

    public static Student getStudent(User user, Student student) {
        student.setName(user.getName());
        student.setUserName(user.getUserName());
        student.setPhone(user.getPhone());
        student.setPassword(user.getPassword());
        student.setType(user.getType());
        student.setEmail(user.getEmail());
        student.setPotrait(user.getPotrait());
        student.setCreateTime(user.getCreateTime());
        student.setUpdateTime(user.getUpdateTime());
        return student;
    }
}
